'use strict';
// Copyright 2014 Blueant Inc. All Rights Reserved.

/**
 * @fileoverview 玩家信息
 * @author sundbcn@gmail.com (sun debing)
 */

var _ = require('lodash');

/**
 * 获取玩家信息
 * @param {[type]} mail_model [description]
 */
exports.getRoleInfo = function (role_model, bag_model, vip_model, battle_model) {
    return _getRoleInfo(role_model, bag_model, vip_model, battle_model);
};

/**
 * 获取玩家信息
 * @param {[type]} mail_model [description]
 */
var _getRoleInfo = function (role_model, bag_model, vip_model, battle_model) {
    var equip_list = [];
    var wear_equip_list = _.values(bag_model.wear_equip_list);
    for (var j = 0; j < wear_equip_list.length; j++) {
        for (var i = 0; i < bag_model.equip_list.length; i++) {
            if (wear_equip_list[j] == bag_model.equip_list[i].equip_id) {
                equip_list.push(bag_model.equip_list[i]);
            }
        }
    }
    return {
        job_type: role_model.job_type,
        name: role_model.name,
        lv: role_model.lv,
        vip: role_model.vip,
        noble: battle_model.noble,
        constellation_lv: role_model.constellation_lv,
        wear_equip_list: equip_list
    };
};
